<html>
<head>
<style type="text/css">
	@import "/site_media/dojo/dojo/resources/dojo.css";
	@import "/site_media/dojo/dijit/themes/soria/soria.css";
</style>
<script type="text/javascript" src="/site_media/dojo/dojo/dojo.js"
	djConfig = "parseOnLoad:true, isDebug:true" ></script>
<!--<script type="text/javascript" src="/site_media/dojo09/dojox/data/QueryReadStore.js"></script>-->
<script type="text/javascript" src="/site_media/js/serpantin.js"></script>
<script language="JavaScript" type="text/javascript">
	//dojo.require("dojo.date.locale");
	dojo.require("dojo.parser");
	dojo.require("dijit.form.FilteringSelect");
	dojo.require("dojox.data.QueryReadStore");
    dojo.require("dojo.data.ItemFileReadStore");

	dojo.provide("MyQueryReadStore");
	dojo.declare("MyQueryReadStore", dojox.data.QueryReadStore, {
		fetch:function(request) {
			request.serverQuery = {q:request.query.name};
			return this.inherited("fetch", arguments);
		}
	});
	// TODO: try setDisplayedValue with FilteringSelect
	function UpdateStore(js_id, server_url) {
		/* reinitialisation of the ComboBox Store */
		//alert("UpdateStore" + js_id + server_url);
		js_id.store = new dojo.data.ItemFileReadStore({url:server_url});
	}
</script>
</head>
<body class="soria">
	<form method="post" action="/test/">
		<div dojoType="MyQueryReadStore" jsId="store" url="/json/common/Town" requestMethod="get"></div>
		<!-- <input dojoType="dijit.form.FilteringSelect" name="town" jsId="town" store="store" pageSize="5"
			onChange="UpdateStore('town', '/json/?q=' + arguments[0])"/> -->
		<!--<input dojoType="dijit.form.FilteringSelect" name="town" value="3" jsId="town" store="store" pageSize="5"/>-->
		<select dojoType="dijit.form.FilteringSelect" name="town" jsId="town" store="store" pageSize="5">
			<option value="3" selected="selected">Isengard</option>
		</select>
		<br /><br /><hr />
		<input type="submit" value="Go!" />
	</form>
</body>
</html>
